import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
from matplotlib.ticker import MultipleLocator,FuncFormatter
from matplotlib import cm
from matplotlib import colors
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import matplotlib.ticker as ticker

def printList(array,dim=2):
    if dim==2:
        for i in array:
            print(i)
    if dim==1:
        print(array)
def curve(x,y,label='first',x1=[],y1=[],label1='second',x2=[],y2=[],label2='third',prompt="曲线如图所示"):
    print(prompt)
    plt.plot(x,y,label=label)
    plt.plot(x1,y1,label=label1)
    plt.plot(x2,y2,label=label2)
    plt.legend()
    plt.show()

def threeD(xd,yd,zd,Xlabel='x',Ylabel='y',Zlabel='z'):
    xd=np.array(xd)
    yd=np.array(yd)
    zd=np.array(zd)
    fig = plt.figure()
    ax1 = plt.axes(projection='3d')
#    ax1.set_zlim3d(0.5,0.6)设置z轴的显示范围
#    ax1.set_ylim3d(10,20)
    ax1.scatter3D(xd, yd, zd, cmap='Blues')  # 绘制散点图
    plt.xlabel(Xlabel)
    plt.ylabel(Ylabel)
    plt.show()
def progressBar(time,times,prompt="已完成："):
    now=round((time + 1) * 100 / times,2)
    print('\r' + prompt + str(now), end='%', flush=True)

if __name__=='__main__':
    threeD()